package com.saxon.controller;

import com.alibaba.fastjson.JSONArray;
import com.saxon.pojo.BlogType;
import com.saxon.service.Blog.BlogServiceImpl;
import com.saxon.service.Blog.BlogTypeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.Mapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@Controller
public class BlogTypeController {
    private BlogTypeServiceImpl blogTypeService;

    @Autowired
    public void setBlogTypeService (BlogTypeServiceImpl blogTypeService) {
        this.blogTypeService = blogTypeService;
    }

    @GetMapping ("/blogType/getAllBlogType")
    @ResponseBody
    public List<BlogType> getAllBlogType () {
        return blogTypeService.QueryAllType ();
    }

    @GetMapping ("/admin/getAllBlogType")
    @ResponseBody
    public List<BlogType> getAllBlogTypeAdmin() {
       return blogTypeService.QueryAllType ();
    }
}
